
222

1111

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="js/echarts.js"></script>
</head>

<body>
  <div id="main" style="width: 600px;height:400px;"></div>
</body>
<script>
  //初始化echarts实例对象
  var mychart = echarts.init(document.getElementById('main'))
  //指定配置项和数据(option)
  var option = {
    // color设置我们线条的颜色 注意后面是个数组
    color: ['pink', 'red', 'green', 'skyblue'],
    // 设置图表的标题
    title: {
      text: '折线图堆叠123'
    },
    xAxis: {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    yAxis: {
      type: 'value'
    },
    series: [{
      data: [820, 932, 901, 934, 1290, 1330, 1320],
      type: 'line'
    }]
  };
  //将配置项设置给echarts实例对象
  mychart.setOption(option)
</script>

</html>